git: adjust error on submodule update failure
authorJoonas Koivunen <joonas.koivunen@gmail.com>
Fri, 14 Apr 2017 05:38:55 +0000 (08:38 +0300)
committerJoonas Koivunen <joonas.koivunen@gmail.com>
Fri, 14 Apr 2017 06:31:12 +0000 (09:31 +0300)
Now instead of reporting single generic "submodule update failed" a
dependency specific submodule update failed error message will be
reported and shown without --verbose.

src/cargo/sources/git/utils.rs
tests/git.rs

index fdf729b5ba1511e424642b34e77cfffed447a9c2..26fbc917edab2664eda7559437825d94ad1a1b76 100644 (file)
@@ -156,9 +156,7 @@ impl GitDatabase {
             }
             Err(..) => GitCheckout::clone_into(dest, self, rev)?,
         };
-        checkout.update_submodules(cargo_config).chain_error(|| {
-            internal("failed to update submodules")
-        })?;
+        checkout.update_submodules(cargo_config)?;
         Ok(checkout)
     }
 
@@ -297,8 +295,8 @@ impl<'a> GitCheckout<'a> {
 
             for mut child in repo.submodules()?.into_iter() {
                 update_submodule(repo, &mut child, cargo_config).chain_error(||
-                    internal(
-                        format!("failed to update submodule `{}`",
+                    human(
+                        format!("Failed to update submodule `{}`",
                             child.name().unwrap_or("")))
                     )?;
             }
index 71feb3146433597822e81c7b5e8a2b6de13d736e..43066847abc874c85c934246ac402599ff76465f 100644 (file)
@@ -796,17 +796,18 @@ fn dep_with_bad_submodule() {
             pub fn foo() { dep1::dep() }
         ");
 
-    assert_that(project.cargo_process("build").arg("--verbose"),
+    assert_that(project.cargo_process("build"),
                 execs().with_stderr(format!("\
 [UPDATING] git repository [..]
 [ERROR] failed to load source for a dependency on `dep1`
 
 Caused by:
-  Failed to update submodules of [..]
+  Unable to update {}
 
 Caused by:
-  [9/-3] object not found - no match for id ({})
-", original_submodule_ref)).with_status(101));
+  Failed to update submodule `src`
+
+To learn more, run the command again with --verbose.\n", path2url(git_project.root()))).with_status(101));
 }
 
 #[test]